#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void reverse(char* begin, char* end)
{
    while (begin < end)
    {
        char tmp = *begin;
        *begin = *end;
        *end = tmp;
        begin++;
        end--;
    }

}
char* trans(char* s, int n) {
    // write code here
    int i = 0;
    char* left = s;
    char* right = s + n - 1;
    reverse(left, right);

    for (i = 0; i < n; i++)
    {
        if (isupper(s[i]))
            s[i] = tolower(s[i]);
        else if (islower(s[i]))
            s[i] = toupper(s[i]);
        else
        {
            right = s + (i - 1);
            reverse(left, right);
            left = s + (i + 1);
        }
    }
    return s;
}

int main()
{
	//char* ch1 = "abc";
	//char ch2[10];
	//gets(ch2);
	//scanf("%s", ch2);
    char a[] = " h i";
    char* ret = trans(a, 4);
	return 0;
}